class SampleController {
	
	com.g2one.gtunes.Song song
	com.g2one.gtunes.Album album
	
	def defaultAction = 'model'
	
    def index = {
		log.info('In the index action...')
		render 'You accessed the Sample controller...'
	}
	
    def exception = {
		try {
			throw new Exception()
		} catch (Exception e) {
			render 'Exception !!! check log'
			log.error ('some message goes here', e)
		}
    }
	
	def xml = {
		render text:'<album>Revoler</album>', contentType:'text/xml'
	}
	
	def model = {
//		책에서 설명하는 Creating a Model 소스
//		this.song = com.g2one.gtunes.Song.get(params.id)
		
		this.song = new com.g2one.gtunes.Song(title: '부른다', artist: '서인국')
		this.album = new com.g2one.gtunes.Album(title: '슈퍼스타K', song: this.song)
	}
}
